﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace EasySL.Share
{

	// 定义如何添加、获取、删除欲进行缓存的对象
	public interface ICacheStrategy {

		// 添加对象
		void AddItem(string key, object obj);

		// 获取对象
		object GetItem(string key);

		// 删除对象
		void RemoveItem(string key);
	}


	public class DefaultCacheStrategy : ICacheStrategy {

		private Hashtable objectStore;

		public DefaultCacheStrategy() {
			objectStore = new Hashtable();
		}

		public void AddItem(string key, object obj) {
			objectStore.Add(key, obj);
		}

		public object GetItem(string key) {
			return objectStore[key];
		}

		public void RemoveItem(string key) {
			objectStore.Remove(key);
		}
	}
}
